cmake_minimum_required(VERSION 2.8)


file(GLOB bittorrent_src "*.cpp")
file(GLOB dht_src "dht/*.cpp")

if (${UNIX_OS})
	include_directories(
		${PROJECT_SOURCE_DIR}/include
		${PROJECT_SOURCE_DIR}//extensions/include
		${by3rd_library_include}
		/usr/local/include
		/opt/local/include
		/usr/include
		)
elseif (${WIN_OS})

else()

endif()


link_directories(/usr/lib/x86_64-linux-gnu)

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE})

add_library(bittorrent SHARED ${bittorrent_src} ${dht_src})

set_target_properties(bittorrent PROPERTIES OUTPUT_NAME "bittorrent")

set_target_properties(bittorrent PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions")

if(CMAKE_BUILD_TYPE STREQUAL Debug)
	set_target_properties(bittorrent PROPERTIES COMPILE_FLAGS "-g3")
endif()

if(CMAKE_BUILD_TYPE STREQUAL Release)
	set_target_properties(bittorrent PROPERTIES COMPILE_FLAGS "-O3")
endif()


install(TARGETS bittorrent
	LIBRARY DESTINATION bin
	ARCHIVE DESTINATION bin)
